function getData() {
	axiosRequest1("get", "/area/areaList").then(res => {
		const {
			code,
			message,
			data
		} = res.data
		if (code === 200) {
			let s = ''
			data.forEach(item => {
				for (let c of item.city) {
					s += `<tr>
						<td>${item.id}</td>
						<td>${item.pNumber}</td>
						<td>${item.pName}</td>
						<td>${c.cNumber}</td>
						<td>${c.cName}</td>
					</tr>`
				}
			})
			$('#tbody').html(s)
			$('.tablelist tbody tr:odd').addClass('odd');
		}
		showMessage(message, 2000)
	}, error => {
		console.log(error);
	})
}

function search() {
	// let data=$('#form').serialize()
	// let data=new FormData($('#form')[0])
	let province = $("#province").val()
	let city = $("#city").val()
	if(province.trim()==='' && city.trim()===''){
		getData()
		return;
	}
	let obj = {}
	if (province.trim() !== '') {
		if (Number(province)) obj.provinceId = Number(province)
		else obj.province = province
	}
	if (city.trim() !== '') {
		if (Number(city)) obj.cityId = Number(city)
		else obj.city = city
	}
	axiosRequest1("post", "/area/query", obj).then(res => {
		const {
			code,
			message,
			data
		} = res.data
		if (code === 200) {
			let s = ''
			for (let c of data.city) {
				s += `<tr>
					<td>${data.id}</td>
					<td>${data.pNumber}</td>
					<td>${data.pName}</td>
					<td>${c.cNumber}</td>
					<td>${c.cName}</td>
				</tr>`
			}
			$('#tbody').html(s)
		}
		showMessage(message, 2000)
	}, err => {
		console.log(err);
	})
}
